package com.myway.common.ibe;

import com.myway.common.ibe.config.IBEClientConfig;
import com.travelsky.ibe.client.IBEClient;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by yufei on 2017/11/8.
 * 使用模板方式调用连接IBE系统
 */
@Slf4j
@Setter
@Getter
public abstract class BaseIBECommand implements IBECommand{


    /**
     * 连接IBE系统参数配置，由springmvc管理 注入
     * 具体参数见springmvc配置文件
     */
    private IBEClientConfig config  = new IBEClientConfig();

    /**
     *
     * @param client
     */
    public void configIBEClient(IBEClient client){
        log.info("连接IBE系统...");
        client.setAgentInfo(config.getOffice(),config.getCustomno(),config.getValidationno());
        client.setApp(config.getApp());
        client.setConnectionInfo(config.getIp(),Integer.valueOf(config.getPort()));
        log.info("use ip "+config.getIp()+" to access travelsky ibe.");
    }
}
